home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_11 / phillip2 / texture.c < prev    next >
C/C++ Source or Header  |  1993-10-10  |  4KB  |  126 lines

  1.  
  2.     /********************************************
  3.     *
  4.     *    file d:\cips\texture.c
  5.     *
  6.     *    Functions: This file contains
  7.     *       main
  8.     *
  9.     *    Purpose:
  10.     *       This file contains the main calling
  11.     *       routine for texture subroutines.
  12.     *
  13.     *    External Calls:
  14.     *       gin.c - get_image_name
  15.     *       tiff.c - read_tiff_header
  16.     *       txtrsubs.c - sigma
  17.     *                    skewness
  18.     *                    amean
  19.     *                    adifference
  20.     *                    hurst
  21.     *                    compare
  22.     *
  23.     *    Modifications:
  24.     *       12 August 1993 - created
  25.     *
  26.     ********************************************/
  27.  
  28. #include "cips.h"
  29.  
  30.  
  31.  
  32. short the_image[ROWS][COLS];
  33. short out_image[ROWS][COLS];
  34.  
  35. main(argc, argv)
  36.    int argc;
  37.    char *argv[];
  38. {
  39.  
  40.    char name[80], name2[80];
  41.    int  count, i, ie, il, j, le, length, ll, size,
  42.         t, type, v, width;
  43.  
  44.  
  45.    struct   tiff_header_struct image_header;
  46.  
  47.    my_clear_text_screen();
  48.  
  49.  
  50.    if(argc < 7){
  51.     printf("\n\nNot enough parameters:");
  52.     printf("\n");
  53.     printf("\n   usage: texture in-file out-file type ");
  54.     printf("threshold? threshold-value size");
  55.     printf("\n   recall type: sigma      skewness");
  56.     printf("\n                amean      adifference");
  57.     printf("\n                hurst      compare");
  58.     printf("\n   threshold?   1-threshold on");
  59.     printf("\n                2-threshold off\n");
  60.     printf("\n   usage for compare:");
  61.     printf("\n   texture in-file out-file compare ");
  62.     printf("line element size");
  63.     exit(0);
  64.    }
  65.  
  66.    strcpy(name, argv[1]);
  67.    strcpy(name2, argv[2]);
  68.    t    = atoi(argv[4]);
  69.    v    = atoi(argv[5]);
  70.    size = atoi(argv[6]);
  71.  
  72.    il = 1;
  73.    ie = 1;
  74.    ll = ROWS+1;
  75.    le = COLS+1;
  76.  
  77.    read_tiff_header(name, &image_header);
  78.  
  79.    length = (ROWS-10 + image_header.image_length)/ROWS;
  80.    width  = (COLS-10 +image_header.image_width)/COLS;
  81.    count  = 1;
  82.    printf("\nlength=%d  width=%d", length, width);
  83.  
  84.    for(i=0; i<length; i++){
  85.       for(j=0; j<width; j++){
  86.  
  87.         printf("\nrunning %d of %d", 
  88.                 count, length*width);
  89.         count++;
  90.  
  91.         if(strncmp(argv[3], "compare", 3) == 0)
  92.            compare(name, name2, the_image, out_image,
  93.                    il+i*ROWS, ie+j*COLS,
  94.                    ll+i*ROWS, le+j*COLS,
  95.                    t, v, size);
  96.  
  97.         if(strncmp(argv[3], "hurst", 3) == 0)
  98.            hurst(name, name2, the_image, out_image,
  99.                  il+i*ROWS, ie+j*COLS,
  100.                  ll+i*ROWS, le+j*COLS, size);
  101.  
  102.         if(strncmp(argv[3], "adifference", 3) == 0)
  103.            adifference(name, name2, the_image, 
  104.                        out_image, il+i*ROWS, 
  105.                        ie+j*COLS, ll+i*ROWS,
  106.                        le+j*COLS, size);
  107.  
  108.         if(strncmp(argv[3], "amean", 3) == 0)
  109.            amean(name, name2, the_image, out_image,
  110.                  il+i*ROWS, ie+j*COLS, ll+i*ROWS,
  111.                  le+j*COLS, size);
  112.  
  113.         if(strncmp(argv[3], "skewness", 3) == 0)
  114.            skewness(name, name2, the_image, out_image,
  115.                     il+i*ROWS, ie+j*COLS, ll+i*ROWS,
  116.                     le+j*COLS, size, t, v);
  117.  
  118.         if(strncmp(argv[3], "sigma", 3) == 0)
  119.            sigma(name, name2, the_image, out_image,
  120.                  il+i*ROWS, ie+j*COLS, ll+i*ROWS,
  121.                  le+j*COLS, size, t, v);
  122.  
  123.       }
  124.    }
  125.  
  126. }  /* ends main  */